home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-10-04 | 4.8 KB | 139 lines |
-
- package sub_arctic.constraints;
-
- /**
- * Base class for objects that represent standard lightweight constraints.
- * Here we store the integer encoding as well as the orientation of the
- * constraint and a reference to the constraint_impl object that understands
- * the encoding.
- *
- * @author Scott Hudson
- */
- public class std_constraint implements constraint {
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Encoding of constraint as an integer. */
- protected int _encoding;
-
- /** Encoding of constraint as an integer. */
- public int encoding() {return _encoding;}
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** The implementation object for this constraint. */
- protected constraint_impl _impl;
-
- /** The implementation object for this constraint. */
- public constraint_impl impl() {return _impl;}
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Orientation of the constraint. This is a bitset made up of any of:
- * std_encoding_consts.HORIZONTAL, std_encoding_consts.VERTICAL, and/or
- * std_encoding_consts.NOT_ORIENTED.
- */
- protected int _orientation;
-
- /** Orientation of the constraint. This is a bitset made up of any of:
- * std_encoding_consts.HORIZONTAL, std_encoding_consts.VERTICAL, and/or
- * std_encoding_consts.NOT_ORIENTED.
- */
- public int orientation() {return _orientation;}
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Full constructor.<p>
- *
- * @param int encode_val the encoding for this constraint.
- * @param constraint_impl imp the implementation object that
- * understands the encoding above.
- * @param int orient the orientation of the constraint (one
- * or more bits from
- * std_encoding_consts.HORIZONTAL,
- * std_encoding_consts.VERTICAL, and/or
- * std_encoding_consts.NOT_ORIENTED).
- */
- public std_constraint(int encode_val, constraint_impl imp, int orient)
- {
- _encoding = encode_val;
- _impl = imp;
- _orientation = orient;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Constructor defaulting to the standard constraint implementation.<p>
- *
- * @param int encode_val the encoding for this constraint.
- * @param int orient the orientation of the constraint (one
- * or more bits from
- * std_encoding_consts.HORIZONTAL,
- * std_encoding_consts.VERTICAL, and/or
- * std_encoding_consts.NOT_ORIENTED).
- */
- public std_constraint(int encode_val, int orient)
- {
- _encoding = encode_val;
- _orientation = orient;
- _impl = std_constraint_impl.the_impl();
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Create a human readable string describing the constraint. */
- public String toString()
- {
- if (impl() == null) return "NULL CONSTRAINT IMPL";
-
- return impl().str_for(encoding(), orientation());
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Create a terse human readable string describing the constraint. */
- public String tag()
- {
- if (impl() == null) return "0IMP!";
-
- return impl().tag_for(encoding(), orientation());
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Indicate if this constraint is actually encoding for no constraint. */
- public boolean is_none()
- {
- if (impl() == null) return true;
- return impl().is_none(encoding());
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Indicate if this constraint is encoding for an external constraint. */
- public boolean is_external()
- {
- if (impl() == null) return true;
- return impl().is_external(encoding());
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-